﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace ukeasbjWeb
{
    public partial class PasswordEdit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            Common_SXD.Is_LongIn(Response, Session, Request);

            TextLabel_Email.Text = Session["Email"].ToString().Trim();
            
        }

        protected void Bt_OK_Click(object sender, EventArgs e)
        {
        /// Email 与 旧密码相符， 更新密码。
        /// 
            if (TextBox_NewPassword.Text.ToString().Trim() != TextBox_NewPasswordAgain.Text.ToString().Trim())
            {
                Response.Write("<li>两次输入的密码不一致！</Li>");
                return;
            }

                        
            ///固定密码
            string sOldPassword = Common_SXD.Read_FixedPassword(TextLabel_Email.Text.ToString().Trim());
            
            if ((sOldPassword == TextBox_OldPassword.Text.ToString().Trim()) &&
                (TextBox_NewPassword.Text.ToString().Trim() == TextBox_NewPasswordAgain.Text.ToString().Trim()))
            {
                Common_SXD.Update_FixedPassword(TextBox_NewPassword.Text.ToString().Trim(),
                    TextLabel_Email.Text.ToString().Trim(), Response);
            }
            else
                Response.Write("<li>修改密码出错！</Li>");

        }

    }
}
